(function(e,t){if(typeof define==="function"&&define.amd){define(["video.js"],function(i){return e.Vimeo=t(i)})}else if(typeof module==="object"&&module.exports){module.exports=e.Vimeo=t(require("video.js"))}else{e.Vimeo=t(e.videojs)}})(this,function(e){"use strict";var t={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3};var i=e.getComponent("Tech");var n=e.extend(i,{constructor:function(e,t){i.call(this,e,t);if(e.poster!=""){this.setPoster(e.poster)}this.setSrc(this.options_.source.src,true);setTimeout(function(){this.el_.parentNode.className+=" vjs-vimeo";if(n.isApiReady){this.initPlayer()}else{n.apiReadyQueue.push(this)}if(this.options_.poster==""){$.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(e){return function(t){e.setPoster(t[0].thumbnail_large)}}(this))}}.bind(this))},dispose:function(){this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-vimeo","")},createEl:function(){this.vimeo={};this.vimeoInfo={};this.baseUrl="https://player.vimeo.com/video/";this.baseApiUrl="http://www.vimeo.com/api/v2/video/";this.videoId=n.parseUrl(this.options_.source.src).videoId;var e="vimeo_wrapper_"+this.options_.playerId;var t=document.getElementById(e);if(!!t)t.parentNode.removeChild(t);this.iframe=document.createElement("iframe");this.iframe.setAttribute("id",this.options_.techId);this.iframe.setAttribute("title","Vimeo Video Player");this.iframe.setAttribute("class","vimeoplayer");this.iframe.setAttribute("src",this.baseUrl+this.videoId+"?api=1&player_id="+this.options_.techId);this.iframe.setAttribute("frameborder","0");this.iframe.setAttribute("scrolling","no");this.iframe.setAttribute("marginWidth","0");this.iframe.setAttribute("marginHeight","0");this.iframe.setAttribute("webkitAllowFullScreen","0");this.iframe.setAttribute("mozallowfullscreen","0");this.iframe.setAttribute("allowFullScreen","0");var i=document.createElement("div");i.setAttribute("style","padding-bottom: "+document.getElementById(this.options_.playerId).offsetHeight+"px;");i.setAttribute("class","vimeoFrame");i.setAttribute("id",e);i.appendChild(this.iframe);return i},initPlayer:function(){var i=this;if(this.vimeo&&this.vimeo.api){this.vimeo.api("unload");delete this.vimeo}i.vimeo=$f(i.iframe);e.players[i.options_.playerId].on("fullscreenchange",function(){i.iframe.parentNode.setAttribute("style","padding-bottom: "+document.getElementById(i.options_.playerId).offsetHeight+"px;")});window.addEventListener("resize",function(e){i.iframe.parentNode.setAttribute("style","padding-bottom: "+document.getElementById(i.options_.playerId).offsetHeight+"px;")});i.vimeoInfo={state:t.UNSTARTED,volume:1,muted:false,muteVolume:1,time:0,duration:0,buffered:0,url:i.baseUrl+i.videoId,error:null};this.vimeo.addEvent("ready",function(e){i.onReady();i.vimeo.addEvent("loadProgress",function(e,t){i.onLoadProgress(e)});i.vimeo.addEvent("playProgress",function(e,t){i.onPlayProgress(e)});i.vimeo.addEvent("play",function(e){i.onPlay()});i.vimeo.addEvent("pause",function(e){i.onPause()});i.vimeo.addEvent("finish",function(e){i.onFinish()});i.vimeo.addEvent("seek",function(e,t){i.onSeek(e)})})},onReady:function(){this.triggerReady();this.trigger("loadedmetadata");if(this.startMuted){this.setMuted(true);this.startMuted=false}if(this.playOnReady){this.play()}},onLoadProgress:function(e){var t=this.vimeoInfo.duration!=e.duration;this.vimeoInfo.duration=e.duration;this.vimeoInfo.buffered=e.percent;this.trigger("progress");if(t)this.trigger("durationchange")},onPlayProgress:function(e){var t=this.vimeoInfo.duration!=e.duration;this.vimeoInfo.time=e.seconds;this.vimeoInfo.duration=e.duration;this.trigger("timeupdate");if(t)this.trigger("durationchange")},onPlay:function(){this.vimeoInfo.state=t.PLAYING;this.trigger("play")},onPause:function(){this.vimeoInfo.state=t.PAUSED;this.trigger("pause")},onFinish:function(){this.vimeoInfo.state=t.ENDED;this.trigger("ended")},onSeek:function(e){this.trigger("seeking");this.vimeoInfo.time=e.seconds;this.trigger("timeupdate");this.trigger("seeked")},onError:function(e){this.error=e;this.trigger("error")},error:function(){switch(this.errorNumber){case 2:return{code:"Unable to find the video"};case 5:return{code:"Error while trying to play the video"};case 100:return{code:"Unable to find the video"};case 101:case 150:return{code:"Playback on other Websites has been disabled by the video owner."}}return{code:"Vimeo unknown error ("+this.errorNumber+")"}},src:function(e){if(e)this.setSrc(e);else return this.source},poster:function(){return this.poster_},setPoster:function(e){this.poster_=e},setSrc:function(e){if(!e){return}this.source=e;this.url=n.parseUrl(e);this.videoId=this.url.videoId;this.iframe.setAttribute("src",this.baseUrl+this.videoId+"?api=1&player_id="+this.options_.techId);this.vimeoInfo.url=this.baseUrl+this.videoId;if(this.options_.autoplay&&!o){if(this.isReady_){this.play()}else{this.playOnReady=true}}else{if(!this.options_.poster){if(this.url.videoId){$.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(e){return function(t){e.poster_=t[0].thumbnail_small}}(this));this.checkHighResPoster()}}}},supportsFullScreen:function(){return true},load:function(){},play:function(){if(this.isReady_){this.vimeo.api("play")}else{this.trigger("waiting");this.playOnReady=true}},pause:function(){this.vimeo.api("pause")},paused:function(){return this.vimeoInfo.state!==t.PLAYING&&this.vimeoInfo.state!==t.BUFFERING},currentTime:function(){return this.vimeoInfo.time||0},setCurrentTime:function(e){this.vimeo.api("seekTo",e);this.player_.trigger("timeupdate")},duration:function(){return this.vimeoInfo.duration||0},buffered:function(){return e.createTimeRange(0,this.vimeoInfo.buffered*this.vimeoInfo.duration||0)},volume:function(){return this.vimeoInfo.muted?this.vimeoInfo.muteVolume:this.vimeoInfo.volume},setVolume:function(e){this.vimeo.api("setvolume",e);this.vimeoInfo.volume=e;this.player_.trigger("volumechange")},currentSrc:function(){return this.el_.src},muted:function(){return this.vimeoInfo.muted||false},setMuted:function(e){if(e){this.vimeoInfo.muteVolume=this.vimeoInfo.volume;this.setVolume(0)}else{this.setVolume(this.vimeoInfo.muteVolume)}this.vimeoInfo.muted=e;this.player_.trigger("volumechange")},checkHighResPoster:function(){var e="";try{$.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(e){return function(t){e=t[0].thumbnail_large}}(e));var t=new Image;t.onload=function(){if("naturalHeight"in this){if(this.naturalHeight<=90||this.naturalWidth<=120){this.onerror();return}}else if(this.height<=90||this.width<=120){this.onerror();return}this.poster_=e;this.trigger("posterchange")}.bind(this);t.onerror=function(){};t.src=e}catch(e){}}});n.isSupported=function(){return true};n.canPlaySource=function(e){return e.type==="video/vimeo"};var o=/(iPad|iPhone|iPod|Android)/g.test(navigator.userAgent);n.parseUrl=function(e){var t={videoId:null};var i=/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/;var n=e.match(i);if(n){t.videoId=n[5]}return t};function r(){var e=".vjs-vimeo .vjs-iframe-blocker { display: none; }"+".vjs-vimeo.vjs-user-inactive .vjs-iframe-blocker { display: block; }"+".vjs-vimeo .vjs-poster { background-size: cover; }"+".vimeoplayer { width:100%; height:180%; position:absolute; left:0; top:-40%; }"+".vimeoFrame { margin:0 auto;padding-bottom:56.25%;width:100%;height:0;position:absolute;overflow:hidden; }"+".vjs-fluid .vimeoFrame { top: 0; }";var t=document.head||document.getElementsByTagName("head")[0];var i=document.createElement("style");i.type="text/css";if(i.styleSheet){i.styleSheet.cssText=e}else{i.appendChild(document.createTextNode(e))}t.appendChild(i)}n.apiReadyQueue=[];var s=function(){n.isApiReady=true;r();for(var e=0;e<n.apiReadyQueue.length;++e){n.apiReadyQueue[e].initPlayer()}};s();e.registerTech("Vimeo",n);var a=function(){function e(t){return new e.fn.init(t)}var t={},i=false,n=false,o=Array.prototype.slice,r="*";e.fn=e.prototype={element:null,wasReady:false,init:function(e){if(typeof e==="string"){e=document.getElementById(e)}this.element=e;return this},api:function(e,t){if(!this.element||!e){return false}var i=this,n=i.element,o=n.id!==""?n.id:null,r=!f(t)?t:null,a=f(t)?t:null;if(a){u(e,a,o)}s(e,r,n);return i},addEvent:function(e,t){if(!this.element){return false}var i=this,o=i.element,r=o.id!==""?o.id:null;u(e,t,r);if(e!="ready"){s("addEventListener",e,o)}else if(e=="ready"&&n&&!this.wasReady){this.wasReady=true;t.call(null,r)}return i},removeEvent:function(e){if(!this.element){return false}var t=this,i=t.element,n=i.id!==""?i.id:null,o=l(e,n);if(e!="ready"&&o){s("removeEventListener",e,i)}}};function s(e,t,i){if(!i.contentWindow.postMessage){return false}var n=JSON.stringify({method:e,value:t});i.contentWindow.postMessage(n,r)}function a(e){var t,i;try{t=JSON.parse(e.data);i=t.event||t.method}catch(e){}if(i=="ready"&&!n){n=true}if(!/^https?:\/\/player.vimeo.com/.test(e.origin)){return false}if(r==="*"){r=e.origin}var o=t.value,s=t.data,a=a===""?null:t.player_id,u=d(i,a),l=[];if(!u){return false}if(o!==undefined){l.push(o)}if(s){l.push(s)}if(a){l.push(a)}return l.length>0?u.apply(null,l):u.call()}function u(e,i,n){if(n){if(!t[n]){t[n]={}}t[n][e]=i}else{t[e]=i}}function d(e,i){if(i&&t[i]){return t[i][e]}else if(t[e]){return t[e]}}function l(e,i){if(i&&t[i]){if(!t[i][e]){return false}t[i][e]=null}else{if(!t[e]){return false}t[e]=null}return true}function f(e){return!!(e&&e.constructor&&e.call&&e.apply)}function h(e){return toString.call(e)==="[object Array]"}e.fn.init.prototype=e.fn;if(window.addEventListener){window.addEventListener("message",a,false)}else{window.attachEvent("onmessage",a)}return window.Froogaloop=window.$f=e}()});